<?php
/**
 * Created by PhpStorm.
 * User: weijer
 * Date: 2018/10/26
 * Time: 21:17
 */

namespace common\validate;

class DirectoryTemplate extends BaseValidate
{
    //验证规则
    protected $rule = [];

    // Create 验证场景定义
    public function sceneCreate()
    {
        return $this->append('data.name', 'require|max:128')
            ->append('data.template_content', 'array');
    }

    // Update 验证场景定义
    public function sceneUpdate()
    {
        return $this->append('data.id', 'require')
            ->append('data.name', 'max:128')
            ->append('data.template_content', 'array');
    }

    public function sceneSaveType()
    {
        return $this->append('data', 'require')
            ->append('data.id', 'require')
            ->append('data.type', 'require')
            ->append('data.content', 'array');
    }

    public function sceneDeleteType()
    {
        return $this->append('param.filter', 'require')
            ->append('param.filter.id', 'require')
            ->append('param.filter.type', 'require');
    }


    public function sceneSaveItem()
    {
        return $this->append('param.filter', 'require')
            ->append('param.filter.id', 'require')
            ->append('param.filter.type', 'require')
            ->append('data', 'require')
            ->append('data.dir_name', 'require')
            ->append('data.dir_path', 'require');
    }

    public function sceneGetTemplateContentTypeData()
    {
        return $this->append('param.filter', 'require')
            ->append('param.filter.id', 'require');
    }

    public function sceneGetTemplateContentTypeDataByProject()
    {
        return $this->append('param.filter', 'require');
    }

    public function sceneDeleteItem()
    {
        return $this->append('param.filter', 'require')
            ->append('param.filter.id', 'require')
            ->append('param.filter.type', 'require')
            ->append('param.filter.dir_name', 'require');

    }
}
